<?php
	class baivietbs
	{
		// Các trường
		public $MaBaiViet = 0; // auto_increment
		public $MaLoaiChuyenMuc = 0;
		public $TieuDe = "";
		public $TomTat = "";
        public $HinhAnh= "";
        public $TenHinh= "";
		public $NoiDung = "";
		public $NgayDang = "";
		public $LuotXem = 0;
		public $XuatBan=0;
		
		// Các phương thức
		public function Them()
		{
			$db = new baivietdb();
			return $db->Them(	$this->MaLoaiChuyenMuc,
								$this->TieuDe,
								$this->TomTat,
                                $this->HinhAnh,
                                $this->TenHinh,
								$this->NoiDung,
								$this->NgayDang,
								$this->LuotXem,
								$this->XuatBan);
		}
		
		public function LayDanhSach()
		{
			$db = new baivietdb();
			return $db->LayDanhSach($this->MaBaiViet, 
									$this->MaLoaiChuyenMuc,
									$this->NgayDang, 
									$this->LuotXem,
									$this->XuatBan,
									$this->TieuDe);
		}
		
		public function CapNhat()
		{
			$db = new baivietdb();
			return $db->CapNhat($this->MaBaiViet, 
								$this->MaLoaiChuyenMuc, 
								$this->TieuDe, 
								$this->TomTat, 
								$this->HinhAnh,
                                $this->TenHinh,
								$this->NoiDung);
		}
	
		public function CapNhatXuatBan()
		{
			$db = new baivietdb();
			return $db->CapNhatXuatBan($this->MaBaiViet, 
									   $this->XuatBan);
		}		
		
		public function Xoa()
		{
			$db = new baivietdb();
			return $db->Xoa($this->MaBaiViet);
		}
		
		public function XoaTatCa()
		{
			$db = new baivietdb();
			return $db->XoaTatCa();
		}
	}
?>